package com.zhu.ecology;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by DELL on 2016/2/2.
 */
public class LogWriter {
    public static final String LOG_FILE_PATH = "D:/sign.log";

    public static void writeLog(String log) {
        if (log == null) {
            return;
        }

        PrintWriter writer = null;
        try {
            writer = new PrintWriter(new FileOutputStream(new File(LOG_FILE_PATH), true));
            writer.println(log);

            writer.flush();
        } catch (IOException e) {
            e.printStackTrace();;
            if(writer != null){
                writer.println("-------------------------" + e.getMessage());
            }
        }finally{
            if(writer != null){
                writer.close();
            }
        }
    }
}
